home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 3 / Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso / utilities / disksalv2 / install < prev    next >
Text File  |  1996-05-20  |  11KB  |  319 lines

  1. ;======================================================================
  2. ;
  3. ; Some basic strings
  4.  
  5. (set #disksalv-install 
  6.      (cat "\nInstall DiskSalv\n"
  7.           "\nYou may install the DiskSalv program and related "
  8.           "files in the directory of your choice.  Proceed?"))
  9.  
  10. (set #disksalv-install-help
  11.      (cat "\nThis section lets you choose in which drawer or on "
  12.           "which disk the DiskSalv program will be installed."
  13.           "\n\nIf you choose to proceed, you will be asked where you "
  14.           "want the DiskSalv files placed.  If you choose "
  15.           "to skip this part, you will go to the portion of the "
  16.           "installation that processes language installations".))
  17.  
  18. (set #which-disk
  19.      "In which disk or drawer should DiskSalv be installed?")
  20.  
  21. (set #any-locale
  22.      (cat "\nInstall DiskSalv Localizations\n"
  23.           "\nYou may install the DiskSalv locale files for various "
  24.           "languages in the LOCALE: directory.  Proceed?"))
  25.  
  26. (set #any-locale-help
  27.      (cat "\nDiskSalv can be operated in different languages."
  28.           "\n\nIf you choose to proceed, you will be asked to "
  29.           "select the translations you want available on your"
  30.       "system."))
  31.  
  32. (set #which-language "\nWhich catalogs should be installed?")
  33.  
  34. (set #which-language-help
  35.      (cat "\nDiskSalv can be operated in many different "
  36.          "languages. One file will be copied to your "
  37.          "hard drive for each language supported.\n\n"
  38.          "To reduce the amount of space consumed by the "
  39.          "language files, you can select only the "
  40.          "files of specific languages to be copied.\n\n"
  41.          "Check the boxes of the languages you wish "
  42.          "to have available on your system.\n\n"
  43.          @askoptions-help))
  44.  
  45. (set #docs-install
  46.      (cat "\nInstall DiskSalv Documentation\n"
  47.           "\nA small manual for DiskSalv can be installed in the"
  48.           "\ndirectory of your choice.  Proceed?"))
  49.  
  50. (set #which-docs "\nWhich manuals should be installed?")
  51.  
  52. (set #docs-install-help
  53.      (cat "\nThis section lets you choose in which drawer or on "
  54.           "which disk the DiskSalv documentation will be installed."
  55.           "\n\nIf you choose to proceed, you will be asked where you "
  56.           "want the DiskSalv documents placed.  If you choose "
  57.           "to skip this part, installation is complete."))
  58.  
  59. (set #docs-where
  60.      (cat "\nIn which disk or drawer should DiskSalv documentation "
  61.           "be installed?"))
  62.  
  63. (set #system-catalog "locale:catalogs"
  64.      #subdir-catalog "locale/catalogs"
  65.      #subdir-docs    "locale/docs"
  66.      #dscatname      "DiskSalv.catalog"
  67.      #dsdocname      "DiskSalv.doc"
  68.      #tmp-dir        "T:DiskSalv")
  69.  
  70. (set #get-dearchiver
  71.      (cat "\nPlease specify the file name of a de-archiver "
  72.           "program for \"LHA\"-type files."))
  73.  
  74. ;======================================================================
  75. ;
  76. ; This function asks about the language, and sets the global "lang" to
  77. ; the language bit mask returned by the request.
  78. ;
  79.  
  80. (procedure ASKLANGUAGE
  81.    (if (= askmode 0)
  82.        ((set lang (askoptions (prompt #which-language)
  83.                               (help #which-language-help)
  84.                               (choices "dansk"
  85.                                        "deutsch"
  86.                                        "english"
  87.                                        "français"
  88.                                        "italiano"
  89.                                        "norsk"
  90.                                        "suomi"
  91.                                        "svenska")))
  92.          (if (IN lang 2) (set doclang 1))
  93.          (if (IN lang 7) (set doclang (+ doclang 2))))
  94.      (if (= doclang 0)
  95.          ((set doclang (askoptions (prompt #which-docs)
  96.                        (help #which-language-help)
  97.                                    (choices "english" "svenska")))))))
  98.  
  99. ;======================================================================
  100. ;
  101. ; This function finds a de-archiver in the user's system, resulting to
  102. ; a panic "ask-the-user" if none can be found.
  103. ;
  104.  
  105. (procedure FINDARCPROG
  106.    (set n 0)
  107.    (while (set test (select n "lharc"
  108.                               "lha"
  109.                               "lz"
  110.                               ""))
  111.       (if (not (run (cat "which " test)))
  112.           (set arcprog test))
  113.       (set n (+ n 1)))
  114.  
  115.    (if (= arcprog "")
  116.        (set arcprog (askfile (prompt #get-dearchiver)
  117.                              (help @askfile-help)
  118.                              (default "C:"))))
  119. )
  120.  
  121. ;======================================================================
  122. ;
  123. ; This function gets the locale file information.  We mark the occasion
  124. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  125. ; for the availability of the archive file. 
  126. ;
  127.  
  128. (procedure ANYLOCALE
  129.    (set localecode 0)
  130.    (if (exists locale-catalogs)
  131.        (set localecode 1))
  132.    (if (exists locale-archive)
  133.        (set localecode (+ localecode 2)))
  134.    localecode)
  135.  
  136. ;======================================================================
  137. ;
  138. ; This function transfers a locale file from the appropriate archive
  139. ; entry to the proper LOCALE:Catalogs subdirectory.
  140. ;
  141.  
  142. (procedure DOCATARCS
  143.    (if (= arcprog "") (FINDARCPROG))
  144.    (if (<> arcprog "")
  145.        ((working "\nDe-archiving selected catalogs\n")
  146.     (makedir #tmp-dir)
  147.         (set arcsfiles (cat #subdir-catalog "/(" arclst ")/#?"))
  148.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  149.                             arcsfiles))
  150.         (set script (tackon #tmp-dir "de-archive-script"))
  151.         (textfile (dest script)
  152.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  153.         (execute script)
  154.         (copyfiles (source (tackon #tmp-dir #subdir-catalog))
  155.                    (dest   #system-catalog)
  156.                    (pattern "#?"))
  157.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  158.  
  159. ;======================================================================
  160. ;
  161. ; This function transfers the locale files from the appropriate 
  162. ; existing subdirectories (in "sublst")  to the corresponding
  163. ; LOCALE:Catalogs subdirectories.
  164. ;
  165.  
  166. (procedure DOCATSUBS
  167.    (copyfiles (source locale-catalogs)
  168.               (dest   #system-catalog)
  169.               (pattern (cat "(" sublst ")"))))
  170.  
  171. ;======================================================================
  172. ;
  173. ; This function selects the language to be installed.
  174. ;
  175.  
  176. (procedure DOLOCALE
  177.    (if (not (exists #system-catalog))
  178.        (makedir #system-catalog))
  179.    (set n      0
  180.         sublst ""
  181.         arclst "")
  182.    (while (set language (select n "dansk"
  183.                                   "deutsch"
  184.                                   "english"
  185.                                   "français"
  186.                                   "italiano"
  187.                                   "norsk"
  188.                                   "suomi"
  189.                                   "svenska"
  190.                                   ""))
  191.      (if (AND (IN lang n) (<> n 2))
  192.         (if (exists (tackon locale-catalogs (tackon language #dscatname)))
  193.             (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language)))
  194.             (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language)))))
  195.      (set n (+ n 1)))
  196.    (if (<> sublst "") (DOCATSUBS))
  197.    (if (<> arclst "") (DOCATARCS)))
  198.  
  199. ;======================================================================
  200. ;
  201. ; This function transfers a doc file from the appropriate archive
  202. ; entry to the selected documentation subdirectory.
  203. ;
  204.  
  205. (procedure DODOCARCS
  206.    (if (= arcprog "") (FINDARCPROG))
  207.    (if (<> arcprog "")
  208.        ((working "\nDe-archiving selected docs files\n")
  209.     (makedir #tmp-dir)
  210.         (set arcsfiles (cat #subdir-docs "/(" arclst ")/#?"))
  211.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  212.                             arcsfiles))
  213.         (set script (tackon #tmp-dir "de-archive-script"))
  214.         (textfile (dest script)
  215.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  216.         (execute script)
  217.         (copyfiles (source (tackon #tmp-dir #subdir-docs))
  218.                    (dest   docoutputdir)
  219.                    (pattern "#?"))
  220.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  221.  
  222. ;======================================================================
  223. ;
  224. ; This function transfers the docs files from the appropriate 
  225. ; existing subdirectories (in "sublst")  to the selected
  226. ; directory.
  227. ;
  228.  
  229. (procedure DODOCSUBS
  230.    (copyfiles (source locale-docs)
  231.               (dest   docoutputdir)
  232.               (pattern (cat "(" sublst ")"))))
  233.  
  234. ;======================================================================
  235. ;
  236. ; This function manages document installation.  It should automatically
  237. ; install any docs based on the requested localizations.  If none match,
  238. ; the user should be given a new choice of languages.
  239. ;
  240.  
  241. (procedure DODOCS
  242.    (set docoutputdir 
  243.         (tackon (askdir (prompt  #docs-where)
  244.                 (help    @askdir-help)
  245.                 (default @default-dest))
  246.                 "DiskSalv_Docs"))
  247.    (set n      0
  248.         sublst ""
  249.         arclst "")
  250.    (while (set language (select n "english"
  251.                                   "svenska"
  252.                                   ""))
  253.      (if (IN doclang n)
  254.         ((set testfile (tackon locale-docs (tackon language #dsdocname)))
  255.          (if (exists testfile)
  256.              (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language "|"
  257.                                                                       language ".info")))
  258.              (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language "|"
  259.                                                                       language ".info"))))))
  260.      (set n (+ n 1)))
  261.    (if (<> sublst "") (DODOCSUBS))
  262.    (if (<> arclst "") (DODOCARCS)))
  263.  
  264. ;======================================================================
  265. ;
  266. ; The main program
  267.  
  268. (set inputdir          (pathonly @icon))
  269. (set locale-archive    (tackon inputdir "DSLocale.lha")
  270.      locale-catalogs   (tackon inputdir #subdir-catalog)
  271.      locale-docs       (tackon inputdir #subdir-docs)
  272.      arcprog           ""
  273.      doclang           0
  274.      @default-dest     "SYS:Tools")
  275.  
  276. ; First, install the DiskSalv program proper
  277.  
  278. (if (askbool (prompt #disksalv-install)
  279.              (help #disksalv-install-help)
  280.              (choices "Yes" "Skip This Part")
  281.              (default 1))
  282.     ((set outputdir 
  283.           (askdir (prompt  #which-disk)
  284.           (help    @askdir-help)
  285.           (default @default-dest)))
  286.      (set @default-dest outputdir)
  287.      (copyfiles (source inputdir)
  288.                 (dest outputdir)
  289.                 (pattern "DiskSalv")
  290.                 (files)
  291.                 (infos))
  292.      (tooltype  (dest (tackon outputdir "DiskSalv"))
  293.                 (noposition)))
  294.     (set @default-dest ""))
  295.  
  296. ; Next, consider the locales.  Ask the user for a selection
  297. ; of catalogs, then call the catalog installer function. 
  298.  
  299.  
  300. (if (ANYLOCALE)
  301.     (if (askbool (prompt #any-locale)
  302.                  (help #any-locale-help)
  303.                  (choices "Yes" "Skip This Part")
  304.                  (default 1))
  305.                   
  306.         ((set askmode 0)
  307.          (ASKLANGUAGE)
  308.          (DOLOCALE))))
  309.  
  310. (if (askbool (prompt #docs-install)
  311.          (help #docs-install-help)
  312.              (choices "Yes" "Skip This Part")
  313.              (default 1))
  314.     ((set askmode 1)
  315.      (ASKLANGUAGE)
  316.      (DODOCS)))
  317.  
  318.  
  319.